That is a great flash to use on a digital Pentax body. I have a stack of Nikon flashes left over from my Nikon days and have used them all of them that have AUTO mode with great success on my K-50 and K-7. I actually find them BETTER then the Pentax flashes in P-TTL. The exposure is much more consistent and even.
The best ones on Pentax bodies I think are the SB24, 25, 26, 28 (back then Nikon's top of the range flashes equivalent to the Pentax AF540FGZ) and the earlier SB-20 (smaller and cheaper) but a great everyday compact alternative for the Pentax K3ii that has no no built-in flash would be the Nikon SB-30.
These all have an AUTO setting that unfortunately was removed from the later Nikon flashes. You can use MANUAL of course but using them in that mode becomes more complex.
The setting I generally use is to set the camera in manual mode on 125-160 shutter speed and the aperture on f4 or f5.6, then set in the flash on AUTO mode and match the camera aperture setting on the flash and shoot away.
One thing I miss from my Nikon days is their flash system. It is vastly superior to Pentax flash system in every way.