They can't, if you're a Judge and you cross the prosecutor too many times they will stop bringing cases to your court and you will find yourself judge of traffic court instead of criminal court. Prosecutor essentially get to pick the judges this way.