Dialogue is piece of the story puzzle that often gets short shrift. Conversation and dialogue is a natural part of human interaction, and to an extent, (as long as you entertain those voices in your head as much as I do) a part of self-awareness. For writing fiction, it's a great way to "show" rather than "tell" so you can do some storytelling through conversation.
When writing character interactions, it's a default mode for many writers to think about what they want to convey--some of the story, something about personality or drama--and get out the quote marks to enclose something that seems to fit the mood. Sometimes it works. But often it results in a sludgy morass that feels hollow and cheap.
While looking for some examples of lame dialogue, to the surprise of no one at all, 50 Shades of Grey and Twilight popped up. But to my shock, so did this quote:
A chuckle sounded beside the globe. A basso voice rumbled out of the chuckle: “There it is, Piter—the biggest mantrap in all history. And the Duke’s headed into its jaws. Is it not a magnificent thing that I, the Baron Vladimir Harkonnen, do?”
Does that not sound a bit like an episode of Scooby? The evil mastermind would have gotten away with it were it not for those meddling kids! But no, this is from Dune by Frank Herbert! I guess anyone can fall victim to bad dialogue.
There is no right or wrong way to write dialogue. For screenplays and scripts used for plays, television or movies, the dialogue is more natural than in fiction. With fiction, there is a bit more leeway toward longer, more "proper" dialogue.
When writing character interactions, I like to keep in mind how people talk in real life. People pause, they stutter, they correct themselves. They used mixed metaphors. They stop halfway through a thought and begin again with something else. Others cut them off or interrupt and the original speaker, or someone else, picks up the dialogue, maybe continuing the thread, maybe channeling it off in some other direction. People speak in short bursts, and go back and forth. We speak in sentences more often than in paragraphs. I have been influenced by the dialogue penned by Paddy Cheyevsky--of even Quentin Terentino. Look at the dialogue in Altered States or The Hospital.
The problem with writing the short bursts and quick back-and-forth that resembles natural dialogue in fiction/narrative form is that you are held back by quote marks and the need for character identification. A real master of fiction, someone like Cormac McCarthy, may elect to skip them entirely and get to the point. For the rest of us, we have to find high ground somewhere in the middle. Unlike with screenplays and scripts, where multiple characters are identified by name for each round of dialogue, with fiction you have to work it in so it flows with a natural cadence and the reader is not jolted out of the story with an abrupt SHE SAID.