In the book Bilbo is also torn between comfort and adventure, but the struggle is internal:
As [the dwarves] sang the hobbit felt the love of beautiful things made by hands and by cunning and by magic moving through him, a fierce and a jealous love, the desire of the hearts of dwarves. Then something Tookish woke up inside him, and he wished to go and see the great mountains, and hear the pine-trees and the waterfalls, and explore the caves, and wear a sword instead of a walking-stick. He looked out of the window. The stars were out in a dark sky above the trees. He thought of the jewels of the dwarves shining in dark caverns. Suddenly in the wood beyond The Water a flame leapt up—probably somebody lighting a wood-fire—and he thought of plundering dragons settling on his quiet Hill and kindling it all to flames. He shuddered; and very quickly he was plain Mr. Baggins of Bag-End, Under-Hill, again.
J. R. R. Tolkien (1937). The Hobbit, chapter 1. London: Unwin.
In a movie it is hard to convey an internal struggle so the writers (Fran Walsh and Philippa Boyens) chose to dramatize it as dialogue between Gandalf and Bilbo. The way they adapted the scene follows the schema of Joseph Campbell’s “Hero’s Journey”, a common template for movie plots, in which the initial “Call to Adventure” (Gandalf’s speech quoted in the question) is followed by the hero’s “Refusal of the Call” (Bilbo: “Sorry, Gandalf, I can't sign this. You've got the wrong hobbit”).
The writers took the details of Gandalf’s speech from various passages in The Hobbit and The Lord of the Rings. The phrase “always running off in search of Elves in the woods” was probably adapted from this dialogue of Bilbo’s:
‘Not the Gandalf who was responsible for so many quiet lads and lasses going off into the Blue for mad adventures? Anything from climbing trees to visiting Elves’
Tolkien (1937), chapter 1.
The phrase might also have been influenced by a description of Frodo in The Lord of the Rings, who
was sometimes seen far from home walking in the hills and woods under the starlight. Merry and Pippin suspected that he visited the Elves at times
J. R. R. Tolkien (1954). The Fellowship of the Ring, book I, chapter 2. London: Allen & Unwin.
Bilbo’s love of maps was taken from here:
He loved maps, and in his hall there hung a large one of the Country Round with all his favourite walks marked on it in red ink.
Tolkien (1937), chapter 1.
The phrase “who would have liked nothing better than to find out what was beyond the borders of the Shire” was adapted from a description of Frodo in The Lord of the Rings:
He looked at maps, and wondered what lay beyond their edges: maps made in the Shire showed mostly white spaces beyond its borders.
Tolkien (1954), book I, chapter 2.
(Note that the name “Shire” does not appear in The Hobbit: Bilbo’s map only shows the “Country Round”.)