There's quite a few factors here...other people had mentioned the differences between work and riding horses, so I'll assume these peasants have access to riding horses.
First thing of note is fighting horseback is not a simple task...it takes practice to ride and even more practice to effectively wield a weapon on horseback (like bracing yourself to avoid the force of your attack pushing you off your own mount). One of the biggest differences between knights and peasants is the number of hours each has available to practice mounted combat...peasants are in the fields and don't have much time to practice these skills. An unskilled man on horseback would make a better show of themselves unmounted and fighting from the ground.
Next note is you don't make mention of tech level much here. Early riders were generally lightly equipped and on horse back mostly for the speed of it, not for the fighting advantage. Heavy Cavalry came along with advances in the stirrup, allowing for the rider to remain mounted despite the heavy armour and forces being put on him. There is also a big difference between a lance that can be effectively used in a charge vs wielding a spear on horse back (which is more like stabbing at things from horseback than it is a lance). Lances are exceedingly effective vs other cavalry and a force that lacks the lance is at a heavy disadvantage.
And another note...people that are riding from birth tend to make good horse archers. (golden horde reference, it was said a mongol warrior was born on horseback...while not quite true, many children were riding horses by the ages of 3-4 apparently). Horses don't have much protection from arrows and depend on their speed to avoid them...if the archers are also mounted, then this speed can be countered. Horse archers can be quite destructive.
And one more...one of the advantages to an all cavalry force is you are extremely fast moving and mobile. One of the more interesting portions of a cavalry vs cavalry battle gets down to the actual engagement. Infantry need time to form and are slower moving...it creates the giant standoffs with both sides lining up. In Cav vs Cav armies, this isn't quite true and it's quite possible for one force to attack the other before it's fully prepared and in it's formations. The actual engagement of 2 cav armies can be an important chess match that wins (or loses) the battle before it even starts.
It's hard to make anything beyond pretty broad generalizations now as I'm unsure the tech level these men are fighting at. I assume peasants on horse back are simply wielding spears and not really able to effectively use them as lances...so as with most battles, any cavalry on cavalry fighting will come down to which side has the training. A 'knight', someone well trained for war both in a tactical sense such as using a lance and in a discipline sense such as riding in formation and not fleeing in panic at the first sight of blood, will always have a great advantage. In a battle like this, the morale and training of an army will win the battle.
I think there are only 3 or 4 documented battles of forces with heavy cavalry losing to an infantry only enemy...properly trained and equipped cavalry have little difficulty plowing over people on foot. Spears, terrain, a little luck and a lot of discipline is the only real defense to it.
Spears - You need a way of bracing them...a cavalry charge is at it's most dangerous from trampling...you have a heavy horse charging full speed at a not so heavy human. Even if the human has a spear, the most it's going to do is a slight stab before being pushed a side. The spear must be braced and have little room to move for it to be effective.
Terrain - trees are effective horse stopper, open terrain usually ends up in a win for the cavalry. Infantry that have had time to fortify can dig out holes and have places for their spears to be braced.
Discipline - There's a horde of 500 cavalry charging straight towards your position...there you are with a few hundred others holding a spear and watching the oncoming charge. Do you flee or do you hold your ground?
add a comment:
In a world like this, fortifications become exceedingly important and effective. Even wooden stockade like walls that a person could easily climb over but the horse can't jump, you are having the effect of dismounting a troop that is better off on horseback. Heh, even wooden posts close enough together that a person could squeeze through but their horse couldn't makes a semi effective wall.
Gunpowder can be a heavy invention in this world...instead of training peasants to use spears and potentially lances which can take many hours of training to accomplish, a peasant can be given a musket like weapon with little training beyond how to point, fire, and reload...put them on horseback and they can quickly engage and disengage. Not a professional fighting force by any means, but the ability to fire the weapon then run off on their light horse to a place they can reload then repeat gives the peasant a weapon and tactic that can be used with little training.
Guns themselves won't eliminate how effective cavalry are until the advent of rapid fire (machine guns and the sort). After machine guns come around, cavalry generally use their horses to travel, but dismount for actual battle...horses in a machine gun battle is messy.
Edit:
Late medieval tactics:
I missed your tech range...a simple cheap spear is not a weapon in the late medieval times. Warfare in late medieval times had advanced to the point where if you weren't prepared for war, you weren't going to succeed...having a spear is not a valid defence.
Cavalry are by no means the end all in a military campaign...though there was a time where they could be, the development of heavy armor and huge pikes and halberds began skewing the battle in favor of the infantry. It's one thing for a charging horse to meet a bunch of spears being held by the weight of a man and a completely different thing for a charging horse to meet a 10 foot long iron pike wall fully braced and designed to impale. You get a bit of a loop...cavalry > sword and shield infantry > pikemen/halberds > cavalry and so on.
To give you an idea of what they were up against...Spanish lancers and Germanic knights became the tanks of the medieval world. The riders were so heavily armored that if they were knocked off their horse, they would be unable to stand back up without the help of a few aides. Cheap spears were pretty much ineffective against troops like this and you required specialized tools (mancatcher) to fight this. English, French, Italian (Venetian), Flemish, and a few others all followed these lines.
That said...one of the key improvements you would see here is army mobility...not too different from the later cavalry...riding a horse on the campaign trail and dismounting for a fight is a completely legitimate tactic.