I don’t think there is any strong reason to prefer Mac or Windows for their own sake for SU, except for personal preference and your own past experience. It isn’t difficult to switch from one to the other nowadays. I had used Windows and DOS for three decades before switching to an iMac 27" just over a year ago, and found it fairly easy to get used to. And the 27" one has a gorgeous 5K screen.
Both the machines you are looking at only have integrated graphics, and it doesn’t look as if you can add a dedicated card.
There are quite a number of reported problems with the quality and support of OpenGL graphics drivers for both the different Intel cards in the two machines. Search this forum for the built in graphics chips by number (Intel Iris Pro Graphics 6200, and Intel HD 530), and see whether either or both get a clean bill of health for SU 2017 - it REQUIRES OpenGl v3.0 or higher support to work at all, and the drivers need to be bang up to date.
The iMac you suggest has a slow hard disk. In the 27" iMacs, there’s an option (at higher cost) to get a Fusion drive which combines an SSD and hard disk for much faster general loading of programs, and somewhat faster use. If there is such an option AND you find no real problems on the forum for that graphics chip, it would work well.
So would the HP all-in-one, and it’s a good deal cheaper. BUT the graphics card may be a problem.
Are you set on getting an all-in-one machine?
Just did what I recommended - searched the forum for the graphics cards. Both have problems, and even if they might be fixable with driver updates sometime/maybe/never, they won’t give good performance in SU. Most of the Sages strongly recommend dedicated nVida cards, as they usually have the best drivers and rarely give problems with SU.
Unless you can find a different all-in-one with either a dedicated graphics card as WELL as the on-board chip (like some laptops) OR a suitable slot to plug in a dedicated card like the GEForce 1060, you would be well advised to go for a desktop case and separate monitor. If space is an issue, consider a compact case with a mini-ITX motherboard.
Or (if for other reasons) you want a desktop Mac, the more expensive iMac 27" that I use works well with SU - it has a dedicated AMD Radeon R9 M395 graphics card, and the drivers seem to work well enough.
The only problem i’ve had with it was when I tried to use a 3DConnexion CADmouse (the same has been reported with their SpaceMouse) and Space Navigator which use the same driver and plugins). The driver and plugin ran away with memory at a rate of several GB a minute, and crashed Sketchup after a few minutes use. I returned the mouse, and finally managed to uninstall all the software, and things went back to normal.