True Polymorph, sort of
Although this wouldn't give you permanent control
Object into Creature: You can turn an object into any kind of creature, as long as the creature's size is no larger than the object's size and the creature's challenge rating is 9 or lower. The creature is friendly to you and your companions. It acts on each of your turns. You decide what action it takes and how it moves. The DM has the creature's statistics and resolves all of its actions and movement.
If the spell becomes permanent, you no longer control the creature. It might remain friendly to you, depending on how you have treated it.
This usage of the spell would allow you to create a creature that is in the same form of the object that would become permanent if you maintained concentration for 1 hour. Unfortunately, there are not many animated objects officially released (a rug, a sword, a suit of armor, and a table are all we have so far) so as a DM, I would probably find a creature similar to the target animated object and simply modify the stat block to account for the intended use.
(credit to Voromir Kadien for his comment)
Maybe Wish
If you truly wanted permanent control as is indicated for the constructs in the Monster Manual, the only option is to use wish. This would also be the only option if you want a challenge rating above 9. Unfortunately, this is entirely DM discretion and does come with a 33% chance that wish is lost to you forever.