It may be legal to install a new speedometer as long as there is a sticker in the door jamb or some other location dictated by your state law (if applicable) to say the odometer had been serviced as of *** date and original mileage was 95,*** or something to that effect. It really depends on the laws of your state. Illinois USED to require an odometer disclaimer decal, but that was many many moons ago. Need to check with DMV or even talk to a dealership. They know those things as well.
The deal with that is that if your title says it had, say 25K miles on it when you titled it and if you sell it, the next guy goes to title it at 18K...it'll look fishy. And they may come after YOU. But if you had a decal in the door jamb declaring the car had 95K miles when you put the new one in, shouldn't be an issue.
I say if you can set the new odometer to read approximately what your old one did, you're golden. It's technically more for the miles on the VIN, not the engine or other pieces parts as they could be rebuilt, swapped, etc.
With that said...do what needs doing. It's up to you.