She just needs discipline.
Explain to the teacher she is out of control and running into roads. School might agree to do a focus on road safety in assembly. Tell the teacher in short term you are going to make her comply by having a rein. This may entail some delays gettting to or leaving school as she will scream and refuse.
you let her. You don’t blink first. If you had done this when she was 2 or 3 she would have learned that your “No, you will walk beside me” means something.
If she wants to lie in the pavement and scream because she’s tied to the pram or to ur wrist, let her. Don’t get cross just calmly wait.
Personally I’d practice at the weekend first, go out twice on Sat and Sun and walk the route to school, see how she gets on. If she manages to walk nicely then she gets a lot of praise and reward.
Distract her with a game of I Spy or talking about food or toys or summer holidays, or “let’s pretend who lives in that house.”
Let her take charge of deciding where and when it’s safe to cross a road - get her to tell the baby to stop at the edge of the pavement, tell the baby how you decide if it’s safe to cross. Guide her gently if she is wrong and praise her if she stops nicely and makes a good decision.
Once she learns to infallibly stop at a road and wait, it doesn’t matter if she runs ahead a little bit.
As for running off in parks - you contract beforehand that “we will go to the park today and tomorrow. I will tell you when there is five minutes to go at the park, and then you have to leave when I say. If you don’t, we won’t be able to go to the park again tomorrow because it’s not safe for you to run away from me.”