I'm glad you said "encourage." Some parents would say "make" (as in "force").
I'm convinced that children need to BE respected in order to really understand the value of respecting others' needs and desires. If they haven't experienced that great pleasure, they will probably never get beyond "respect" as an annoying concept held up by a lot of (rather arbitrary sounding) rules. Nobody really wants to go there, adult or child!
Children will internalize the Golden Rule (treat others as you wish to be treated) much more quickly if adults are consistently modeling this principle themselves. I'll bet your daughter's teacher has learned a few things over the years about fostering this process.
What this always meant to me is that I treated my daughter as a whole person, complete with her own needs and wishes that might be different from mine. If her needs were to keep her toys to herself, I did not insist that she share (although I love Julie's suggestion that toys left in shared space are available to whomever wants to play with them). How can a child understand a rule that frustrates her basic instincts?
What I did, though, as she became old enough to reason, was to help her notice when someone would share with her, and ask her a question or two about it, such as:
Why do you think xxx shared with you?
How does that make you feel? How do you think you would feel if xxx didn't share?
Do you like xxx for sharing? Do you feel she likes you when she shares with you?
Do you feel grateful? Did you tell xxx thank you?
Do you think you might like to share with xxx next time? Why (or why not)?
I noticed that you shared with xxx today. I'm proud that you did that! How does that make you feel about yourself?
There are lots more questions that can be asked, and I never made a big deal (a heavy life lesson) out of this process. Childhood is long, and there are dozens of opportunities every day to make your points and do your teaching gently, a tiny bit at a time. It all adds up, especially if you are consistent and clear in your intentions.
I do NOT agree that parents should lay lavish praise on their kids every time they do something that the parent wants. Children are quick to sense manipulation and insincerity. A touch of praise now and then is appropriate - kids want to know they are pleasing you.
But consider – to grow in maturity, children really need to learn to feel pride in themselves. They need uncluttered emotional space in which this can happen. Plus, if parents lay it on too thick for some things and then fail to notice or praise the subtler signs of maturity, it will be confusing to children who have learned to look to you for all their approval.