This is going to depend on the map, how far the resupply cabinet is from a building area, where you want to deploy your sentry, and what sort of ammo supplies are near the desired deployment area.
If you know there is a full ammo pack, or a couple of a 100-metal ammo packs, near your desired location, you should probably just build it there and get resupplied without going back to spawn. You will fare better if you drop your dispenser before your sentry as well, and make sure to help it build faster while you wait for ammo to respawn... this will give you an extra ammo boost for upgrading your sentry. In general I think this is the faster option.
However, if you know of a good sentry position that has no ammo nearby (or only a small 41-metal item), and you won't have too far to run between the resupply cabinet and a buildable area, and that buildable area is pretty close to the place where you want your sentry, then this option can be faster. I'd say for most maps it isn't the better option. It does have one nice feature though: you can keep the sentry out of danger until the enemy uses their first ubercharges and avoid rebuilding the gun.
Above all keep in mind that it's almost always better for your team to build a level 3 teleporter and dispenser than it is to have a level 3 sentry. A level 1 sentry with player support is still pretty effective, and the healing of your dispenser and fast replacement of allied players is MUCH better than the extra damage you get from a level 3 sentry in almost all scenarios. Also, offensive teams almost always build an ubercharge or two during setup time, which they will often use to immediately clear out any sentries that are nearby (but will rarely use to target teleporters and dispensers).