Relations between President Trump and the intelligence community can be improved. The president can tone down his rhetoric when it comes to talking about the CIA. Likewise, the CIA can refrain from leaking information about Trump to the public. In short, improving relations between Trump and the CIA is a two-way street.
Relations between Trump and the intelligence community would improve if Trump simply stopped contradicting, criticizing and insulting them publicly. However, he has no interest in doing that. He loves stirring up controversy, drawing attention to himself and appearing to be intelligent. If he deferred to the intelligence community, it would appear that they are smarter than him, which is unacceptable to Trump.
Relations between Trump and the intelligence community be improved, but the intelligence community needs to understand that it can no longer do as it pleases without being called out. Those says are over. Trump doesn't care if it makes you uncomfortable. You can make excuses for why you shouldn't be called out, but he is right.
Trump knows that people in the CIA leaked information about him. Trump was smart to run this little test and figure it out so quickly. Trump needed to send the message to the CIA that he cannot trust them if they are going to work against him. Relations won't improve until the CIA improves.