Since the question specifies the Age-of-Sail, we're concerned with the period between 1650 and 1850. The link between nutrition and healthnutrition and health on long voyages was only really established in the last half century of that period. So the idea of cultivating fresh vegetables and fruit for the voyage would not have been an obvious one for most of the Age-of-Sail.
Sailing ships of the period were typically capable of carrying stores for up to 3-6 months (depending on the size of the ship and crew). In the normal course of a journey, these stores would be replenished any time that the ship was in reach of a friendly coast. Since the vast majority of voyages in this period were relatively short (and most of those were along coastal routes), ships could be kept provisioned without the need to grow their own food.
So only very long distance voyages, such as these voyages of discovery where the possibility of being unable to replenish from shore was in doubt, would raise the need for on-board cultivation of foods. (N.B: live animals were kept on board ships to provide fresh meat but these were in small numbers to meet short-term needs rather than providing long-term sustainence.)
The Wikipedia articles on Lapérouse's ships, the Astrolabe and the Boussole, notes that they were specially fitted for this scientific voyage. I would imagine that the addition of a garden could have been part of this fitting out process (although it's not explicitly mentioned). There's also the possibility that the garden(s) may have been intended to help bring back live plant samples from their voyage.
There are several difficulties with maintaining a garden on board a sailing ship of the period;
- There's a limit on deck space. By modern standards, sailing ships were small and cramped. The weather (topmost) deck, which would have been the most obvious location for a garden, would already be filled with much of the equipment needed to sail and control the vessel (along with the ship's boats).
- The ships weren't weather proof. In heavy weather it wouldn't be unusual for spray (or even waves) to sweep over the entire ship. So there would be a real risk of the garden being washed into the sea.
- Plants and seawater generally don't mix well. There are some plant varieties that can grow in coastal areas that tolerate higher salt concentrations but these are not your typical human foodstuff.
- Most plants are adapted to their own environments. Too much or too little sunlight or fresh water can damage or even kill them. Freezing temperatures can kill them. So this would restrict the latitudes which would be suitable for the garden to prosper.
- Even if the garden is kept alive and healthy, the harvest of fruits and vegetables is only going to happen once per growing season (so it's not going to provide a steady source of nutrition). For plants away from their natural habitats, there may also be a problem with pollination if its dependent on specific insects.
So all in all, it's safe to assume that gardens were not typical fittings on ships of the period.