The way I explained it to my daughters, school is their job right now. They may not always like it, it might not always be fun, and yes, you MUST follow the rules... but school is their job. Mom and Dad have to work every single day, Monday through Friday (well I work weekend too, but I digress), and their job is to go to school, 5 days a week, and work their butt's off to get good grades, study hard, and be positive examples for the other children.
My 8 year old gets it... my 6 year old is harder to convince.
Make sure you have a set of rules that always apply at home (ex: no running in the house, inside voices, clean up after yourself, etc), and then make sure she's aware of the school rules (the hair thing, uniform [if applicable], listening ears, inside voices, etc)... then maybe get on the same page as her teacher. That was the hardest adjustment for my kids, going from 'house rules' to 'school rules'. I'm pretty slack at home as long as everything they need to do gets done by the end of the day, and I don't have to nag them about it (by some miracle, they listen VERY well)... so I spoke with their teachers, told them how things are at home, and while I didn't ask them to change their rules, I did ask them to be sensitive to the fact that the girls were learning an entirely new set of rules, the school rules.
I also teach my kids to always find the positive in something negative. If they think school's boring, or too hard, I make them write a list of the happy things about school. The positives always outweigh the negatives.
It took years for my kids to get to this point, and yours will too :) Just remind her how proud you are of her when she's setting a good example for the other students and being her teachers best helper!!
Best wishes :)