Recently, significant progress has been made in (2 þ 1)-dimensional conformal field theories without supersymmetry. In particular, it was realized that different Lagrangians may be related by hidden dualities; i.e., seemingly different field theories may actually be identical in the infrared limit. Among all the proposed dualities, one has attracted particular interest in the field of strongly correlated quantum-matter systems: the one relating the easy-plane noncompact CP 1 model (NCCP 1 ) and noncompact quantum electrodynamics (QED) with two flavors (N ¼ 2) of massless two-component Dirac fermions. The easyplane NCCP 1 model is the field theory of the putative deconfined quantum-critical point separating a planar (XY) antiferromagnet and a dimerized (valence-bond solid) ground state, while N ¼ 2 noncompact QED is the theory for the transition between a bosonic symmetry-protected topological phase and a trivial Mott insulator. In this work, we present strong numerical support for the proposed duality. We realize the N ¼ 2 noncompact QED at a critical point of an interacting fermion model on the bilayer honeycomb lattice and study it using determinant quantum Monte Carlo (QMC) simulations. Using stochastic series expansion QMC simulations, we study a planar version of the S ¼ 1=2 J-Q spin Hamiltonian (a quantum XY model with additional multispin couplings) and show that it hosts a continuous transition between the XY magnet and the valence-bond solid. The duality between the two systems, following from a mapping of their phase diagrams extending from their respective critical points, is supported by the good agreement between the critical exponents according to the proposed duality relationships. In the J-Q model, we find both continuous and first-order transitions, depending on the degree of planar anisotropy, with deconfined quantum criticality surviving only up to moderate strengths of the anisotropy. This explains previous claims of no deconfined quantum criticality in planar two-component spin models, which were in the stronganisotropy regime, and opens doors to further investigations of the global phase diagram of systems hosting deconfined quantum-critical points.