The first book I published, Grimhilda!, was based on a stage play. This turned out to have both advantages and disadvantages.
One disadvantage for the book version was that I had a script that worked on stage, and lines that dovetailed into each other. But a book doesn't need page after page of dialogue: there has to be action, and we have to be able to 'see' the characters. You need to free yourself from the limitations of the stage, and have your characters move through their 'scenery' in ways that aren't possible in front of audience. It took quite a bit of rewriting to bring the book to this point.
On the advantage side, I already had dialogue that had proved itself on stage. When it came to writing the book, the best moments in the story had quality dialogue ready to go. (Though it was a task to ditch great bits of dialogue that worked on stage but weren't needed in the book! It's not easy to ditch lines you're fond of.)
One other thing helped with the writing of the book. In the first decade of this century I had the chance to appear in several plays. There's nothing like having to learn dialogue, and then perform it as though it's coming straight from your own brain, to make you very aware of what works on stage.
The plays had been written over the last hundred years, so there was a variety in style. It depends on how old a play is as to how the dialogue is written. Early 20th century plays are dialogue-heavy, and require actors to speak longer phrases and sentences, an art in itself. This doesn't mean that they necessarily sound old-fashioned. The playwrights of the early 20th century were masters of subtlety and give their actors wonderful opportunities to develop characters.
Later plays can still have longer speeches, but they tend more towards shorter dialogue, and bursts of words tossed back and forth between two or more actors. This is a different skill for the actor and a different approach for the playwright.
So how does this relate to writing dialogue in books? There's a tendency in fiction, now, for speeches to be shorter and snappier, and apparently (though not necessarily) more realistic. Furthermore, the author can insert information about how a speech is delivered, how a character is feeling, what action takes place at the same time, and much more. I've been re-reading some of the best P G Wodehouse; it's interesting to see how long a gap there sometimes is between what one character says and another answers, because Wodehouse often writes hilarious material about the characters between their lines of dialogue. These insights into things beyond the dialogue are of course only possible in books.
Anyway, this post came about because I read a piece by Jennifer Zang, in which she recommends that writers (especially screenwriters) should take some acting classes in order to give them a better sense of how dialogue works - especially in films. But her comments apply to books as well.
Acting requires you to think about why the character is speaking, it enables you to understand economy of words (I've been in plays where the director has cut swathes of dialogue in order to move the play along) and it assists you to understand the emotions behind the words.
All things of great value to authors.
Jennifer Zang's article is entitled: Five Reasons a writer should take an acting class, and appears on the Save the Cat website.