The dangerous part of executing villains could be less from the law aspect and more from the villainous backlash from that decision.
When you surround the enemy
Always allow them an escape route
They must see that there is
An alternative to death.
* <PERSON>, The Art Of War
The lack of major threat to life and limb posed by heroes and the justice system provides a "safety net" for villains. As long as they don't go too far, a villain is relatively safe from permanent harm, and should be able to break out of holding without undue fuss. This means that the villains have little incentive to fight all-out, as killing a hero or causing massive collateral damage is liable to cause one of those heroes to decide you might be better off in a coma. And if you lose, hey, you're back on the streets inside of a month, so it doesn't cost you anything to hold back.
Implementing villain execution removes that safety net; each fight is now one that could potentially cause their death, and if they anger a hero badly enough for them to cross a line, that's no more dangerous than being caught in the first place, so they have little to lose and a lot to gain by, say, taking an orphanage hostage, or assassinating a hero.
This doesn't necessarily seem like something that the heroes couldn't deal with; a short period of unrest as the villains are put down, and then a peace once they're gone. However, there's a very important thing that overlooks.
Normally, supervillains are loners, sometimes working in short-lived coalitions for a single task, or in longer-lived pair groups of villains with a personal or professional connection. 164
They sometimes spend more time fighting each other than the heroes! It's fairly rare that you get a significant group of villains all working together over and extended period, and even rarer that they're looking out for each other. This means that in general, superhero teams will have a greater concentration of force than villains will. This ensures that most villains are outmatched by their opposition and so will rarely get to execute plans that will cause harm on a mass scale.
However, by implementing villain execution, it would not be out of the question for villains to see this as a declaration of war. With a charismatic leader or rabble-rouser at the forefront, you could very well see a massive coalition of villains form with the sole purpose of making certain that the government will never be able to enforce their sentence, whether by threats of unspeakable violence if the sentence is passed, or simply by obliterating pieces of the governmental engine until it is unwilling or unable to follow through.
So in short, never back your enemy into a corner, and take that doubly seriously when you're talking about a population of superpowered criminals.
I'd also like to acknowledge part #3 of <PERSON>'s answer. There are some threats so vast that you might need the villains' help to defeat; <PERSON> comes to mind, or the Endbringers from Worm. 164