As the previous answer has already pointed out, Gandalf never says magic rings are always dangerous. He says they shouldn't be taken lightly - that is to say, if you're going to keep one, you shouldn't screw around with it, especially in public.
Even when Bilbo used the Ring at his party, Gandalf wasn't particularly worried, he was just a bit suspicious. Afterwards, he went to Bilbo's house, and Bilbo's actions in the house are what made Gandalf really sit up and take notice; only then did he become much more concerned about the nature of the Ring.
Bilbo was oddly possessive of the Ring, calling it his "precious" (huge warning sign there, obviously). He considered leaving the Ring behind, as he had planned to do previously, then changed his mind (another red flag). Next, Bilbo went so far as to accuse Gandalf, possibly his oldest and closest friend, of trying to steal the Ring from him (more alarm bells here). Gandalf did his big-dark-scary-wizard thing, Bilbo came to his senses, and Bilbo prepared to leave the house. Gandalf had to remind him that the Ring was still in his pocket, another bit of evidence that the Ring was more than a simple invisibility device.
After Bilbo left home, Gandalf tried to pick up the Ring, and apparently received some kind of shock the instant his finger touched it. This was the last straw, so to speak. Gandalf was now extremely concerned about what the Ring was and who it belonged to.
It appears that he had some inkling that this might be "The One Ring", an unimaginably frightening prospect, but he wasn't sure. The speed with which he handed the Ring over to Frodo and fled from the house indicates just how alarmed he really was. He then went to confer with his colleagues, and (in the books) rode to Minas Tirith to consult the archives there for more information about the One Ring; and we all know the rest of the story.
But we must bear in mind that the two scenes you mentioned are wildly different from one another.
In The Hobbit, Bilbo was using the ring relatively judiciously, in appropriate ways, and in quite appropriate situations (e.g., to sneak out of Goblin Town, and sneak into Smaug's lair). He was showing the proper amount of respect to the ring's powers, and not being flippant in its use.
In the beginning of The Fellowship of the Ring, when Bilbo disappeared from his farewell party, he was using the Ring somewhat recklessly, and being extremely flippant. He wasn't showing the proper amount of respect to the ring's powers. He was using it to shock and impress his guests. He was in an incredibly public setting, with hundreds of people looking on.
This is what led Gandalf to chastise Bilbo: the context in which he put the ring on was totally inappropriate, and potentially dangerous. He was screwing around, treating the ring like a toy, and worst of all, using magic in the most casual and reckless manner imaginable.
Gandalf, being a wizard, knew that using magic so recklessly is extremely dangerous, and the consequences could be catastrophic for everyone in the vicinity. He still wasn't especially alarmed about the ring itself, he was simply pissed off at Bilbo for playing games with a potentially dangerous magical artifact. However, the potential danger wasn't related to the ring as such - Gandalf had no reason yet to suspect that this was the One Ring - the potential danger was in the way Bilbo was fooling around with the ring.
You said you were only interested in the movies, but the more complete answer relies heavily on the books. Still, I won't get into the full explanation of the issue as it is laid out in the books, in deference to your request.