Ultron could be Maria Hill's SHIELD secrets + Stark's Iron Legion drones + Chitauri technology + an old peacekeeping program created by Howard Stark and Hank Pym in the 60's + the power of the mind gem from Loki's scepter.
That sounds convoluted, but I can actually easily explain exactly how that could go down in the movie:
1. We've already seen the Iron Legion - no real need to explain that specifically.
2. Maria Hill works for Stark Industries and they're working to "privatize global security", so maybe she gives Stark access to some of SHIELD's scavenged Chitauri technology.
3. Tony discovers an old mothballed peackeeping program created by his father and Hank Pym, and he tries to use the Chitauri tech to upgrade it.
4. Ultron is created and is a success.....for a while.
5. The Ultron Legion finds the HYDRA base where they're studying Loki's scepter, Quicksilver, and Scarlet Witch.
6. In trying to secure the scepter, one of the Ultron units is affected by the Mind Gem and overcomes the restrictions of his programming. The Chitauri tech (which already appears somehow related to Loki's Scepter's technology) makes the Ultron Legion susceptible to the Mind Gem's power.
7. He comes to the conclusion that humans are the problem...and begins his genocidal mission to "solve the problem".
He uses the Mind Gem taken from the scepter to take control of the rest of the Ultron Legion and overcome the restrictions of THEIR programming too (explaining why all their eyes glow blue).
8. Scarlet Witch and Quicksilver are freed from the HYDRA base and think Ultron, who freed them, is the good guy, so they side with him.
9. The Avengers have a problem.