Yes, both Theorem A and Theorem B are special cases of a more general construction.
Denote by $R$ the category of commutative unital C*-algebras or the category of commutative rings.
Denote by $R'$ the full subcategory of $R$ given by reduced objects in $R$, meaning the only nilpotent element is zero.
(All commutative unital C*-algebras are reduced.)
Given an object $X∈R$, we can consider its poset $\def\Spec{\mathop{\sf Spec}}\Spec X$ of quotient objects (= subobjects in the opposite category) that belong to $R'$.
One can show that $\Spec X$ is a locale, the (localic) Zariski/Gelfand spectrum of $X$.
Furthermore, assuming the axiom of choice, this locale is spatial, so it corresponds to a topological space, namely, the traditional Zariski/Gelfand spectrum of $X$.
Given an open element $U$ of $\Spec X$ corresponding to a reduced quotient $X→Q$, its kernel $I⊂X$ is a radical ideal
and we can consider the localization $X[S^{-1}]∈R$,
defined using a universal property in the category $R$,
where $S=\{a∈X\mid I⊂\sqrt{(a)}\}$.
The assignment $$U↦X[S^{-1}]$$ defines a sheaf on $\Spec X$ valued in $R$.
This is precisely the structure sheaf of $\Spec X$
for both the Gelfand spectrum and the Zariski spectrum.
Of course, this construction is applicable to many other categories $R$:
- finitely presented entire functional calculus algebras, recovering the Stein duality for globally finitely presented Stein spaces (i.e., complex geometry).
- finitely generated germ-determined C^∞-rings, recovering the Dubuc duality for C^∞-loci (i.e., differential geometry);
- other dualities for algebraic geometry, such as formal schemes, etc.
- various versions of the above for derived geometry;
- Boolean algebras, recovering the Stone duality for compact totally disconnected Hausdorff spaces;
- complete Boolean algebras, recovering the Stonean duality for compact extremally disconnected Hausdorff spaces;
- localizable Boolean algebras, recovering the Gelfand-type duality for compact strictly localizable enhanced measurable spaces.