Dialogue is a great tool for a writer. It lets you communicate what a character’s thinking—or at least, what the character wants others to know she’s thinking—in her own voice, and it contributes to character development by allowing you to show how characters interact with one another. Dialogue makes it possible to allow your character to speak directly, rather than having to filter the speech through a narrator. Sometimes it’s nice to be able to have your character explicitly state: “I like ice cream!” rather than having the narrator describe that “Sarah likes ice cream.”
Good dialogue is also fun for the reader, because the verbal interaction of characters helps the reader get engrossed in the story. People in real life talk (I’m fairly certain verbal communication in some form or other is one of the human race’s great pastimes), so it makes sense that dialogue can be a great way to pull your reader into the story. For this reason, a lot of authors use dialogue as a way to reveal exposition or setting.
For instance, rather than telling us that Johnny is wearing a red shirt that looks like it came from the 80s, one could simply have another character (let’s take Sarah from before) say: “Ugh, Johnny, where’d you get that ridiculous shirt? That red is so out of style and, um, in case you haven’t noticed, so are the 80s.” (Note: this does not necessarily reflect my opinion of the 80s.) Now, Johnny’s red shirt isn’t terribly important—actually it may be, depending on where this story’s going—but you see how the reader learns what it looks like through the dialogue? This is often a more interesting and, importantly, a more subtle way to convey factual information.
However, there is a fine line between using dialogue to subtly reveal facts about the plot or setting and simply piling tons of exposition into a piece of dialogue. Say Johnny and Sarah are mechanics; if I have to read line after line of them explaining some mechanical process that’s apparently crucial to the plot, it just won’t feel right. Dialogue like this is stiff and wooden, and frankly, unnecessary. If they’re both mechanics, why are they explaining this stuff to each other? Even if one of them were not a mechanic, it's still awkward. Obviously the writer is trying to explain the relevant elements of mechanics to the reader, but if the explanation is going to be a long one, dialogue is not really the best way to do this. Instead you can leave this kind of thing to the narrator, because at the end of the day, characters should sound like themselves, not as if they’re mouthpieces for the narrator. (Of course, this can get complicated when the narrator is a character as well.)
An information dump can work in narration, but in general, if the information is extremely technical and/or does not sound natural to the character or the situation, you want to keep that out of your dialogue. The reader wants to hear the characters talk, so give them something worth listening to. Best of luck!
—S.E.