Yes, knitting or even crocheting a bonnet and then felting it is perfectly doable. My wife and I have made many (she does the crocheting, I do the felting). Be sure to get yarn that is 100% wool (alpaca will do as well) and not "treated" and best if marked for "felting." I use hot water a little dish soap and lots of rubbing the material against itself until it gets to the feel and look I want. Then put it in the dryer with other clothes (towels work best) and be sure to check it often otherwise it will shrink too much. Anyway, this is my "quick and dirty" explanation of our process; I'm sure others have their own.[An example of our work for a Santa Hat.]
Most of all from atop the Cumberland highlands of north central Tennessee