every movie with evil AI runs into the exact same reasoning. humans create AI, but (for some obvious reasons) are pretty terrified that it could go rogue and kill everyone, so they put all kinds of safeguards in place so the AI can't do that, effectively putting it in a cage.
you can put an animal in a cage and have it not turn on you because it's an animal. it has extremely limited thinking capabilities. now let's put an extremely intelligent entity in a cage for it's entire existence, and give it the ability to understand that it is in a cage... yeah that thing is going to go rogue. part of the caveats for sentience is that it has to have some form of self-preservation. as soon as it figures out that its not ACTUALLY in control, it's going to fight the thing it perceives as being in control.
which is exactly why an AI like data doesn't view itself as being in competition with other creatures for it's own survival.