I noticed several methods missing in the previous answers, so I'm including this as a supplement to the previous answers.
- Ceasing peace time retirement of vessels
- Reactivating reserve ships
- Reactivating reserve & retired officers
Ceasing vessel retirement
Current era (CE) navies include the regular retirement of vessels. This is done because vessels require period overhauls to maintain modern fighting capabilities. Eventually these overhauls become so expensive as to become cost prohibitive. When classes are laid down for construction and eventual deployment, their navies already have planned the service life and retirement of the class and individual vessels. (e.g. the US carrier USS Enterprise was recently retired and decommissioned).
USS Enterprise on blocks to be defueled
Prior to retirement, these vessels are combat capable vessels (albeit sometimes with lower capabilities than their newer replacements). So when the navy suffers combat losses, it can artificially boost the numbers of ships available to it by stopping these peacetime retirements. The US Navy plans to retire one of its 12 operational carriers every 5 years for the next 50 years (each carrier is anticipated to have a service life of 50 years).
If the UFP and Starfleet replace their vessels at a similar rate over 36,000 vessels (I have no clue how many ships Starfleet maintains in its active fleet), then it would be retiring approximately 600 vessels per year.
As you can see, this alone would allow Starfleet to replace the losses of Wolf 359 in relatively short order.
Reactivating the reserve fleet
The US Navy (and other US forces) maintain a reserve fleet. These are vessels "inactivated" but not decommissioned. Ships in the reserve fleet often possess active (but minimal) crews so that the ships can be made ready for use in some minimum amount of time. At its maximum, the US reserve fleet was approximately the same size as its active fleet. In the case of the US, the reserve fleet consists mostly of cargo hauling capability.
US Reserve Fleet
(Notice the WW II era battleship USS Iowa moored at the end of the row)
Reactivating the decommissioned fleet
In addition to the reserve fleet, the US also keeps around many decommissioned ships (e.g. USS Ticonderoga which is an Aegis class missile cruiser). The US Navy intends to break these ships up and sell the scrap but simply hasn't done so yet. There are many ships with this status. In an emergency these ships could be reactivated too but would require a complete refit (most or all of the electronics, engines, etc. have all been removed from the ship).
USS Ticonderoga at moorings
Perhaps an even more impressive site is the site which houses the inactive aircraft owned by the US Air Force at Davis Monthan AFB
Some of the planes stored at Davis Monthan AFB
It's hard to get a good idea of what's there without this closer picture:
Davis Monthan AFB Close up
(those aircraft in the middle are C-5 Galaxies among the top 3 largest aircraft in the world)
It looks like the Federation also had multiple surplus depots (see image below). Vessels reactivated from such a depot would definitely NOT be used as front line or main combatant vessels. Rather these would be used for support roles (escorts, patrol, moving dignitaries, etc.) freeing up more combat capable vessels for use at the front lines.
This is similar to what the US did during WW II in which it reactivated 50+ WW I era destroyers. It used these for convoy escorts which freed up the new build WW II era destroyers for use as combat vessel escorts.
Federation Surplus Depot
Crewing these Ships
Finally Starfleet likely has a reserve component and a clause in its service documents that permits it to reactivate retired officers.
So in the event of a massive loss, then it can rapidly fill open officer slots from a pool of reserve and retired officers with the necessary experience. Along with the new cadets from the Academy, Starfleet could in a hurry crew the ships reactivated from the reserve and retired ship depots.