To write a good conversation, you first need to be picky about what conversations make it into your book. A conversation which doesn’t effect the story, no matter how dynamic, realistic, and well-written, will feel like an unnecessary aside. Dialogue takes up a lot more space than narrating a conversation would. It needs to earn that space by showing readers something important. Characters need to learn valuable information through the conversation, whether that's the password to their bank account or the state of another human being's emotions. The things that are talked about must change the story or reader's perception of the characters by being known.
There are some things that come across particularly well by being shown to readers in a conversation. One example is relationships. Readers don’t like to be told about a relationship between two characters. They want to feel the connection for themselves, which means that it is very important to show relationships and show them changing over the course of the book. During moments of downtime or while characters are going through particularly relationship changing moments, including dialogue can help readers feel the bond between the characters and be invested in the relationship. This is true whether the relationship is improving or declining. Inter-character conflict is just as important to show as characters falling in love.
Decisions can also work well as dialogue conversations. Inner monologues can get tiring to read and can drift into angst or get repetitive. Real people mull over the same thing over and over when making a decision, but characters need to avoid boring readers. One way to show them pondering a decision without sitting inside their head and going in circles is to have them talk their decision through with another person. This pushes them forward and forces them to move through each part of the decision and then move on. When the character weighing the decision gets bogged down, their friends or listeners can express the same frustration the readers will be feeling and cut them off.
Another excellent use of dialogue is to provide the reader with an active and dynamic account of events that your point-of-view character wasn’t present for. This can help tone down unnecessary telling in your novel. The characters who were present can retell the story, be asked questions, and even be unreliable when it suits your needs. Much more interesting than a factual summary of important events.
Speaking of things your point-of-view character doesn’t know, dialogue is a great way to show readers the emotional state of your other characters without necessarily cluing your POV character in. Is one of your characters keeping a huge secret? Is a side character madly in love with your oblivious main character? By showing the conversations directly to the reader, you allow the reader to pick up on things that the point of view character doesn’t notice. This can help fill in the blanks and explain complex side-character motivations without having to switch POV.
As with most forms of showing, dialogue takes up more time and space than narration does. Choosing which conversations to show your readers is a very important step towards making sure that the conversation will be compelling. Don’t waste time with dialogue that isn’t going to strengthen your story. Focus on the moments that readers truly need to hear (well, read) about and you will end up having a much easier time keeping them interested and invested.