Yes, it can be done. In some ways, it's like introducing your child to a new brother or sister.
The dog's and the cat's personalities make a difference. We have introduced cats and dogs to one another for years. One of the first things they do is to determine who is going to be boss. They do it in different ways. Since the dog is usually larger, it may want to chase the cat just for play purposes. The cat will respond either by running more and hiding or else by going into its "make my day" mode or both. It takes a few days for everything to be settled between them. Expect some fussin' and some rude language.
Since your cat is independent (and two years is not very old), Kitty may well declare herself the boss of the house, as you already know she is. After that is established, she will gradually begin letting the dog be her loyal subject, and all will be well. They could very well end up playing together.
Keep an eye on developments. You could start by putting them in separate rooms and letting them sniff under the door or through the baby gate at each other. Your job is to make sure each has a fair chance and there's no accidental injury.
When they begin to play together, watch what they do. When we got our current pup, we had a 17-year-old cat (who has since passed away of natural causes). He was fragile but still interested in the puppy, so he would tease her from the safety of beneath a stool, and when she responded he would yowl as if that awful dog were eating him up. That was his game. The puppy liked it, and so did I after I found out the noise wasn't serious.
If you haven't picked out a dog yet, ask the shelter or the breeder about one with a sweet personality - one who already likes cats or is quite likely to make friends with anybody.
The worst trouble we ever had was not between a cat and a dog, but between a cat and another cat! One of them couldn't adjust to having the other in her territory. But they were both older cats, and even that sort of situation doesn't *always* happen between cats.
Our cats have always welcomed our "home" dogs within a couple or three weeks. When there are visiting dogs, however, they don't bother. Usually they disappear in the recesses of the house, coming out only at night, until the "intruders" have left. (Since they always hide in the same place, I know where to put extra food and water.) Then they reappear for good, and give me a few baleful looks to tell me what they think of the vile company I keep.