@TheAdmiralty nailed it: The dynamic with Spock and McCoy worked because 1) there was never any genuine ill feelings there, it was just friendly insults back and forth, and 2) it was equal participation from both.
Data, on the other hand, was so innocenti g that he just sat there and took everything that Pulaski slung at him. It couldn't even occur to him to fight back. She may not have
intended to take advantage of his nature, but that's what ended up happening.
"Doctor, I believe this empty turbolift shaft requires attention."