If it were me I’d go with the 9700K considering the small difference in price. The better turbo boost speed and two extra real cores more than makes up for the loss of hyperthreading or the slightly lower base clock, which on a desktop machine is unlikely to be a factor (I’ll get to that in a moment).
It’s gotten much more difficult in recent years to adequately compare processors because of the differences in single-core vs multi-core clock speed, turbo boost, and hyperthreading. Not to mention the “megahertz myth” from days of yore that is still true today, wherein a modern processor at the same clock speed as one several years older (or of a different architecture altogether such as X86 vs PowerPC) will almost certainly perform better. It’s the turbo boost and multi-core numbers that really get confusing because it’s not clear without actual benchmarks how the clock rate will throttle down under different load characteristics. In post-Haswell chips different cores can even boost to different clock rates depending on the type of instruction sets they’re processing.
I like to compare the performance of my old 2008 Mac Pro which has (2) 4-core 2.8 GHz Xeon E5462 Harpertown processors. They run at 2.8 GHz under any load no matter what, there’s no turbo boost, no hyperthreading, strictly eight cores and eight threads, though I do believe they can still throttle down under low-load conditions to save energy. My 2017 iMac Pro however has an 8-core 3.2 GHz Xeon W-2140B Skylake processor. On the surface those numbers don’t look all that different, only 14% higher clock speed for the iMac. However, the iMac can theoretically turbo boost to 4.2 GHz which is 50% faster. Nonetheless, the single-core Geekbench score of 5036 for the iMac blows away the Mac Pro’s 1854, showing that the newer processor is getting a lot more done per clock cycle than 10 years ago. The multi-core numbers are also much different, 30842 for the iMac versus 9091 for the Mac Pro.
The Xeon W-2140B appears to be a variant of the W-2145. I’ve never seen it reach 4.2 GHz but with single-threaded instructions it’ll hit 4.0 GHz. Nevertheless, if I throw everything I can at the computer, maxing out a total of 16 threads, it will still hum along at 3.9 GHz with only brief one-second dips to 3.8 GHz (which has been corroborated by others). That’s not bad, and it shows that the thermal design of the computer is doing a good job when it can maintain a speed 700 MHz higher than its rated base clock at full load. It’s actually the same numbers as the W-2145 under an AVX2 workload. Mobile systems can have a much harder time maintaining any turbo boost at all. I’ve observed that any multi-core workload will usually drop them back to their base clock very quickly, even if brief single-core executions can boost up to the processor’s maximum. So for desktop systems with a good cooling system, even the base clock rating is somewhat useless. Confused yet?