Pentax 645D has a
40.0MP Medium format (44 x 33 mm ) sized CCD sensor and features Prime II processor. On the other hand, Pentax K-1 II has a
36.0MP Full frame (35.9 x 24 mm ) sized CMOS sensor and features PRIME IV processor.
Another similarity between these two cameras is that both Pentax K-1 II and Pentax 645D sensors lack anti-alias (Low-Pass) filters. Removing anti-alias filter increases the sharpness and level of detail but at the same time, it increases the chance of moiré occurring in certain scenes.
Below you can see the 645D and K-1 Mark II sensor size comparison.
As seen above, Pentax 645D has a 1.7x Larger sensor area than Pentax K-1 II. Larger sensors give photographer more control on the depth of field and blurry background compared to smaller sensor when shot in same focal length and aperture.