From an epidemiological perspective, nitrates are commonly thought to be adverse to health due to a long-standing restriction on how much nitrate can be in drinking water (50mg/L) or ground water (due to accumulating in vegetables) due to the risk of infantile methemoglobinemia (baby blue syndrome) which does appear to apply to vegetables. More commonly, the association between processed meat products that are pink in color (which very commonly use sodium nitrate as a preservative) and cancer occurrence also paints nitrates in the same negative light. Conversely, vegetables are commonly stated to not be associated with cancer risk (which then raises concern about whether or not they are the same molecules).
Both consumption of vegetables (most commonly researched is Beet Root) and consumption of the sodium nitrate preservative cause increases in serum nitrate and nitrite, and are considered bioequivalent. In some studies that assess nitrate's bioactivity, liquid solutions of sodium nitrate are even used.
There are still differences between eating processed meat and vegetables in this regard (intake of sodium through the preservative sodium nitrate and higher intake of potassium via vegetables; less conversion of nitrate into nitrosamines with coingested antioxidants) but the molecule itself is the same.