It depends on the IPC (instructions per clock) difference between generations, the clockspeeds you're able to hit with your OC, and platform enhancements such as DDR4 vs DDR3 RAM and RAM speed. For Skylake (6000 series) and Kabylake (7000 series) they're virtually identical in everything but clockspeed and some video enhancements. So core for core, whichever reaches higher clocks wins. For older generations, clock for clock they're slower so they need a greater clockspeed advantage in order to pull ahead.
As far as that 25000 number, for one it's definitely overclocked. But the bigger difference is that it's a multithreaded score. i5's have 4 physical cores each running 1 thread. Ryzen 1600 and 1600x have 6 physical cores, each able to run 2 concurrent threads. Ryzen is slower core for core, but it has 50% more cores and 300% more threads than the i5. That more than makes up for the slower cores when you're running heavily multithreaded workloads.