The phrase come from in the special ability share spells is unclear
The animal companion version of the special ability share spells says that
The druid may cast a spell with a target of “You” on her animal companion (as a touch range spell) instead of on herself. A druid may cast spells on her animal companion even if the spells normally do not affect creatures of the companion's type (animal). Spells cast in this way must come from a class that grants an animal companion. This ability does not allow the animal to share abilities that are not spells, even if they function like spells.
Emphasis mine. In the case of an animal companion, then, the druid can only share a spell with his animal companion that comes from the druid class.
And, of course, the phrase come from isn't explicitly defined.
A difficult case can be made that the spell shapechange, for example, comes from the druid class—even were the spell shapechange cast using sorcerer spell slots—because the spell appears on both class's spell lists. I wouldn't expect a favorable outcome in such a case, though.
It's more likely that the druid must cast the spell to be shared using druid spell slots, as that's how most read spells as coming from the class, such as in the consensus reached in these 2014 threads from Jan. and Dec. Thus, a druid wanting to share a spell with his animal companion must cast the spell using a druid spell slot (and probably only using a druid spell slot, not a spell trigger or a spell completion magic item). Likewise, a dragonrider can only share spells with his bonded dragon that the dragonrider casts using dragonrider spell slots.
However, the version of the special ability share spells gained by a familiar omits that emphasized sentence, saying only
The wizard may cast a spell with a target of “You” on his familiar (as a touch spell) instead of on himself. A wizard may cast spells on his familiar even if the spells do not normally affect creatures of the familiar's type (magical beast).
That means a Drd17/Sor1 with the bloodline power arcane bond who picked a familiar could cast (were he able) the spell shapechange twice using druid spell slots and share one casting with his animal companion and the second with his familiar, having 2 Huge dragons, but a Drd1/Sor18 could not cast the spell shapechange using a sorcerer spell slot on his animal companion yet could cast such a spell on his familiar, ending up with only 1 Huge dragon.
Finally, a Druid 17/Sorcerer 1/Dragonrider 2 could share separate druid castings of the spell shapechange with his familiar then his animal companion but not with his bonded dragon, and, similarly, a Druid 1/Wizard 17/Dragonrider 2 could share a wizard casting of the spell shapechange with his familiar but not with his animal companion nor his bonded dragon.