I don't remember Data askin' the computer to locate Picard before imitatin' his voice.
Well, Picard, from engineering, asked the computer for Data's location, which happened prior to Data taking over command functions.
it was voice activated command sequence.
It must have monitored Picard's vocal inflections/tone/pitch and obviously Data got it to a tee.
Well, a tape recorder can do that today

, and vocal synthesis tech has come a long way already...
I agree with Timo and RegFan regarding the computer has some AI in evidence, but in this episode it's as dumb as a doorknob, especially given that the ship was taken over!
In fact, I would find it extremely odd to have one's personal communicator be required for a captain to gain access to a ship's systems.
I'm not so sure...immediately after Data isolated command functions to the bridge, the computer denied the real Picard of giving the computer any orders, and he still had his communicator.